<?php
  session_start();
  include('./varsandfunctions.php');
?>
<html>
  <head>

    <meta name="apple-mobile-web- app-capable" content="yes" />
    <meta name="viewport" content="width=device-width" />
    <link rel="apple-touch-icon" href="supermapsthumb.png" />
    <link rel="stylesheet" href="stylesheets/index.css" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="ciui/CiUI.css" />
    <script src="ciui/CiUI.js" type="text/javascript"></script>
    <script type="text/javascript" src="jquery-1.3.2.min.js"></script>

    <title>New List</title>

  </head>
  <style>
  #savelist{
    margin: 80px 60px;
    padding: 10px 10px 5px 10px;
    text-align:center;
    position:relative;
    width:180px;
    height:30px;
    border: 0.5px solid black;
    -webkit-border-radius:10px;
    -webkit-box-shadow: red 0px 0px 30px;
    background-color:red;
    font-size:1.2em;
    font-family:American Typewriter;
    color:white;
  }

  #save_button {
  	clear: both;
  	height: 30px;
  	font-size: 1.2em;
  	font-family:American Typewriter;
  	color:white;
  	cursor: pointer;
  	margin: 0;
  	padding: 10px 10pt 5px 10px;
  	border:none;
  	background-color:transparent;  
  }
  
  </style>
  <body>
    <?php
      include('./navbar.html');
    ?>
    <div id="iphone_body" style="clear:both;">
      <div id="iphone_header">
        <div id="cancel_button">
          <a href="lists.php" class="go_back"><img src="ciui/images/cancel.png" border="0" align="right" style="margin:3px"/></a>
        </div>
        <div id="iphone_title">New List</div>
      </div>          
      
      <?php
        $listname = $_POST['listname'];
        echo("<div style='text-align:center;font-family:American Typewriter;font-size:1.2em;'>".$listname."<br>has been created!</div>");
        
        //Loop through each location in the session and add it to the Locations database.
        print_r($_SESSION);
        echo($_SESSION['location1']);
        createNewLocation($_SESSION['location1'], 16, "Sightseeing");
        createNewLocation($_SESSION['location2'], 13, "Sightseeing");
        createNewLocation($_SESSION['location3'], 18, "Sightseeing");
        createNewLocation($_SESSION['location4'], 14, "Sightseeing");
        $locations = get_last_id("Locations").",".(get_last_id("Locations")-1).",".(get_last_id("Locations")-2).",".(get_last_id("Locations")-3);
        echo($locations);
        createNewList($listname, "Sightseeing", $locations);
          
      ?>
      
      <a href="lists.php">Back to Lists</a>
      
    </div>
  </body>
</html>
